﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Xml.Serialization;

namespace Cubicle.Excel.Config
{
    [XmlRoot("CubicleScript")]
    [DataContract(Name = "BindingScript")] // NB This must not be = "CubicleScript" - it will screw up svcutil
    [KnownType(typeof(CommandDescription))]
    [KnownType(typeof(FunctionDescription))]
    [Serializable]
    public class BindingScript
    {
        [DataMember]
        [XmlArray]
        public CommandDescription[] CommandSource;

        [DataMember]
        [XmlArray]
        public FunctionDescription[] FunctionSource;

        public BindingScript() { }

        public BindingScript(
            IEnumerable<CommandDescription> commandSource,
            IEnumerable<FunctionDescription> functionSource)
        {
            CommandSource = commandSource.ToArray();
            FunctionSource = functionSource.ToArray();
        }

    }
}
